<?php

session_start();

require_once 'include/config.lib.php';
require_once 'include/database.lib.php';

	$personusername = (string)$_GET['username'];
	
	ConnectToDB();
	$selectid = DBExecute("SELECT id FROM person WHERE username = ?", $personusername);
	if($id = $selectid->fetchAssocRow()){//find the person's id to redirect to the person's own page
		$url = "person_view.php?id=".$id["ID"];		
	}
	else{
		$url = "index.php";
	}
	echo "<HTML><META http-equiv=\"refresh\" content=\"0; url='".$url."'\"></HTML>";//redirect to the person's profile page or homepage if user not valid
?>